/* 
 * Author      		: Adnin Devit CF 
 * Date Created		: 31-Maret-2011 
 * Date Modified	: 6-April-2011 
 * Version			: 1.1 
 * */
package jtk.project4.fleet.field;

import javax.swing.SortOrder;

import org.hsqldb.Table;

//import jtk.project4.fleet.domain.MaintenanceHistory;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;

public class MaintenanceHistoryTable extends GroupControl<String>{
	
	private TableField<String> maintenanceHistoryTable;
	public MaintenanceHistoryTable(String bindID){
		//setTitle("header.MaintenanceHistory");
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields(){
		maintenanceHistoryTable = new TableField<String>("MaintenanceHistoryTable","MaintenanceHistory");
		//maintenanceHistoryTable.setTitle("MaintenanceHistory.header.table");
		maintenanceHistoryTable.setAutoResizeMode(AutoResizeMode.OFF);
		maintenanceHistoryTable.getSelectionValues();
		
		maintenanceHistoryTable.addColumn("label.date","date");
		maintenanceHistoryTable.addColumn("label.millage","millage");
		maintenanceHistoryTable.addColumn("label.workPerformed","workPerform");
		maintenanceHistoryTable.addColumn("label.totalCost","totalCost");
		maintenanceHistoryTable.addColumn("label.downTime","downTime");
		maintenanceHistoryTable.addColumn("label.vendor","vendor");
		maintenanceHistoryTable.addColumn("label.costCenter","costCenter");
		maintenanceHistoryTable.addColumn("label.invoice","po");
		maintenanceHistoryTable.addColumn("label.maintenanceCost","mainCost");
		maintenanceHistoryTable.addColumn("label.repairCost","repCost");
		maintenanceHistoryTable.addColumn("label.partCost","partCost");
		maintenanceHistoryTable.addColumn("label.laborCost","labCost");
		maintenanceHistoryTable.addColumn("label.taxes","taxes");
		maintenanceHistoryTable.addColumn("label.commet","comment");
		
		maintenanceHistoryTable.sort("date", SortOrder.ASCENDING);
	}
	
	private void createLayout(){
		setLayout (new FormLayout())
		.addField(maintenanceHistoryTable);	
	}
}
